#ifndef _MEDIAPLAYER_H
#define _MEDIAPLAYER_H

#include <QScrollArea>

class QString;
class QProcess;
//class QWidget;
class QLabel;

class VideoWidget:public QScrollArea
{
    Q_OBJECT
public:
    VideoWidget(QWidget *parent = 0);
    ~VideoWidget();

    void stop();
    void seekTo(double value);
    void seek(double value);

    void open(QString& fileName);
    void getTimePos();
    double currentPosition() {return m_pos;}
    int getPlayingState()
    {
        return m_mode;
    }
    void togglePause();
    void changeSize(int width, int height);

public slots:
    void readMessage();
    void shot();
    void moveImage();

signals:
    void durationChanged(double value);
    void posChanged(double value);
    void sizeChanged(int width, int height);
    void playFile(QString fileName);
    void addImageEntry(QString fname, QString video, double pos);

protected:
     void dragEnterEvent(QDragEnterEvent *event);
     void dragMoveEvent(QDragMoveEvent *event);
     void dragLeaveEvent(QDragLeaveEvent *event);
     void dropEvent(QDropEvent *event);

private:
    QProcess* m_proc;
    int m_width,m_height;
    double m_length;
    double m_pos;
	double m_fps;
    int m_mode; /*1 playing 2 pause 3 stop*/
    QLabel* video;
    QString m_curFile;
};
#endif
